package com.wc.alorithm_blue_bridge._数学知识.规律.Q1231;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;

/**
 * @Author congge
 * @Date 2023/10/29 21:51
 * @description 三角形的面积
 * https://www.lanqiao.cn/problems/1231/learning/?page=1&first_category_id=1&sort=students_count&second_category_id=8
 */
public class Main {
    public static void main(String[] args) {
        Input sc = new Input();
        int n = sc.nextInt();
        Point[] points = new Point[3];
        Main main = new Main();
        double[] answers = new double[n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j< points.length; j++) {
                int x = sc.nextInt();
                int y = sc.nextInt();
                Point point = new Point(x, y);
                points[j] = point;
            }
            double ans = main.getArea(points);
            answers[i] = ans;
        }
        for(double ans:answers){
            System.out.printf("%.2f\n",ans);
        }
    }

    public double getArea(Point[] points) {
        /**
         * 判断是不是在同一个直线上
         */
        if ((points[0].y - points[1].y) * (points[1].x - points[2].x) == (points[1].y - points[2].y) * (points[0].x - points[1].x)) {
            return 0;
        }
        Point one = points[0];
        Point two = points[1];
        Point three = points[2];
        double totalArea = getTotalArea(points);
        double oneArea = getArea(one, two);
        double twoArea = getArea(one, three);
        double threeArea = getArea(two, three);
        return totalArea - oneArea - twoArea - threeArea;
    }

    public double getArea(Point one, Point two) {
        return Math.abs(one.x - two.x) * Math.abs(one.y - two.y) / 2.0;
    }

    public double getTotalArea(Point[] points) {
        double length = Math.abs(points[0].x - points[1].x);
        length = Math.max(Math.abs(points[0].x - points[2].x), length);
        length = Math.max(Math.abs(points[1].x - points[2].x), length);
        double width = Math.abs(points[0].y - points[1].y);
        width = Math.max(Math.abs(points[0].y - points[2].y), width);
        width = Math.max(Math.abs(points[1].y - points[2].y), width);
        return length * width;
    }

    static class Point {
        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        int x;
        int y;
    }

    static class Input {
        StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

        public int nextInt() {
            try {
                in.nextToken();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return (int) in.nval;
        }
    }
}
